home *** CD-ROM | disk | FTP | other *** search
- //--------------------------------------------
- // SimpleToolBar.cs ⌐ 2001 by Charles Petzold
- //--------------------------------------------
- using System;
- using System.Drawing;
- using System.Windows.Forms;
-
- class SimpleToolBar: Form
- {
- public static void Main()
- {
- Application.Run(new SimpleToolBar());
- }
- public SimpleToolBar()
- {
- Text = "Barra de herramientas sencilla";
-
- // Crea un men· sencillo (solo para mostrarlo).
-
- Menu = new MainMenu();
- Menu.MenuItems.Add("Archivo");
- Menu.MenuItems.Add("Edici≤n");
- Menu.MenuItems.Add("Ver");
- Menu.MenuItems.Add("Ayuda");
-
- // Crea la lista de imßgenes.
-
- Bitmap bm = new Bitmap(GetType(),
- "SimpleToolBar.StandardButtons.bmp");
-
- ImageList imglst = new ImageList();
- imglst.Images.AddStrip(bm);
- imglst.TransparentColor = Color.Cyan;
-
- // Crea la barra de herramientas.
-
- ToolBar tbar = new ToolBar();
- tbar.Parent = this;
- tbar.ImageList = imglst;
- tbar.ShowToolTips = true;
-
- // Crea los botones de la barra de herramientas.
-
- string[] astr = {"Nuevo", "Abrir", "Guardar", "Imprimir",
- "Cortar", "Copiar", "Pegar" };
-
- for (int i = 0; i < 7; i++)
- {
- ToolBarButton tbarbtn = new ToolBarButton();
- tbarbtn.ImageIndex = i;
- tbarbtn.ToolTipText = astr[i];
- tbar.Buttons.Add(tbarbtn);
- }
- }
- }
-